/**
 * 
 */
package de.riceman.simpleGo.view.forms;

import org.springframework.rules.Rules;
import org.springframework.rules.constraint.Constraint;
import org.springframework.rules.support.DefaultRulesSource;

import de.riceman.simpleGo.main.NewGameSetup;

/**
 * @author riceman
 *
 */
public class NewGameFormValidation extends DefaultRulesSource{

	 

	/*private final Constraint NAME_CONSTRAINT = all( new Constraint[]{
			required(), minLength(2), regexp("[-'.a-zA-Z ]*", "alphabeticConstraint")
			});*/

	private NewGameFormValidation() {
		super();
		addRules(createPlayersConfigurationRules());
	}

	 

	private Rules createPlayersConfigurationRules(){

		return new Rules(NewGameSetup.class){

			protected void initRules(){

				//add("darkPlayersName", NAME_CONSTRAINT);

				add("darkPlayersName", required());
				add("lightPlayersName",required());
				add("darkPlayersType", required());
				add("lightPlayersType",required());
				add("gameSize", required());
			}

		};

	}	 

}
